package com.pine.dao.pineframework.constants;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.pine.common.beans.enums.IntegerCodeBaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * <p>
 * 用户表-性别 枚举
 * </p>
 *
 * @author pine manage
 * @since 2024-08-12
 */
@AllArgsConstructor
@Getter
public enum GenderEnum implements IntegerCodeBaseEnum {
    MALE(1, "男"),
    FEMALE(2, "女"),
    SECRECY(0, "保密"),
    ;

    @EnumValue
    private final Integer code;
    private final String desc;

    public static GenderEnum of(Integer code) {
        return Arrays.stream(GenderEnum.values()).filter(genderEnum -> Objects.equals(genderEnum.code, code)).findAny().orElse(null);
    }
}
